import { createRouter, createWebHistory } from 'vue-router';
import home from './home';
import user from './user';
import cart from './cart';
import order from './order';
import manager from './manager';
import book from './book';
import error from './error';

const router = createRouter({
    history: createWebHistory(),
    routes: [
        ...home,
        ...user,
        ...cart,
        ...order,
        ...manager,
        ...book,
        ...error
    ]
});

// 修改页面标题
router.afterEach(to => {
    document.title = to.meta.title;
});

export default router;

